package foliotracker;

import java.io.Serializable;
import java.util.Date;

/**
 * Represents a snapshot of a portfolio's value at a certain point in time.
 */
public class PortfolioValue implements Serializable
{
	private static final long serialVersionUID = 1L;
	private Date date;
	private double value;
	private double profit;
	
	/**
	 * Constructor.
	 * @param date The date the snapshot is valid for.
	 * @param value The total value of the portfolio at that point in time.
	 * @param profit The total profit for the portfolio at the time point.
	 */
	public PortfolioValue(Date date, double value, double profit)
	{
		this.date = date;
		this.value = value;
		this.profit = profit;
	}
	
	/**
	 * Gets the date the snapshot is valid for.
	 * @return
	 */
	public Date getDate()
	{
		return date;
	}
	
	/**
	 * Gets the recorded value of the portfolio.
	 * @return
	 */
	public double getValue()
	{
		return value;
	}
	
	/**
	 * Gets the recorded profit for the portfolio.
	 * @return
	 */
	public double getProfit()
	{
		return profit;
	}
	
	
	/**
	 * Updates the snapshot with the specified values.
	 * @param value
	 * @param profit
	 */
	public void update(double value, double profit)
	{
		this.value = value;
		this.profit = profit;
	}
}
